<template>
	<view class="content">
		<view class="btn"> <button type="success" @click="toEditSeats">修改资料</button></view>
		<view class="info">
			<uni-list>
				<uni-list-item title="客户名称" :note="customer.name" />
				<uni-list-item title="客户电话" :note="customer.phone" />
				<uni-list-item title="预定礼厅" :note="customer.roomName" />
				<uni-list-item title="预定时间" :note="customer.startTime" />
				<uni-list-item title="预定餐桌" :note="customer.tableCount" />
				<uni-list-item title="预定类型" :note="customer.typeName" />
			<!-- 	<uni-list-item title="预留订金" :note="customer.bookingAmount" /> -->
				<uni-list-item title="客户描述" :note="customer.describes" />
			</uni-list>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations
	} from 'vuex'
	export default {
		data() {
			return {
				customer: {
					id: 0
				}
			}
		},
		methods: {
			...mapMutations(['saveCustomer']),
			toEditSeats() {
				uni.navigateTo({
					url: '/pages/feast/EditSeats?id=' + this.customer.id
				});
			},
			//查询个人资料
			async queryCustomer() {
				const {
					status,
					data,
					msg
				} = await this.$api.customer.queryCustomer()
				if (status == 200) {
					data.tableCount = data.tableCount.toString()
					// data.bookingAmount = data.bookingAmount.toString()
					this.customer = data
					//将用户资料信息保存到vuex中
					this.saveCustomer(data)
					// //将用户资料信息保存到vuex中
					// this.saveCustomer(data)
				}
			}
		},
		onLoad(option) {
			this.queryCustomer()
		},
		onShow() {
			this.queryCustomer()
		}

	}
</script>

<style scoped lang="less">
	.content {
		width: 100%;
		height: 100%;

		.btn {
			width: 90%;
			height: 100%;
			margin: auto;
			padding-top: 10upx;

			// background-color: #FA541C;
			button {
				// background-color: white;
				// color: black;

				height: 80upx;
				line-height: 80upx;
			}
		}

		.info {
			width: 100%;
			height: 100%;
			background-color: white;
			margin-top: 10upx;
		}
	}
</style>